<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="./Public/home/css/index.css"/>
		<link rel="stylesheet" type="text/css" href="./Public/home/css/list.css"/>
		<link rel="stylesheet" type="text/css" href="./Public/home/css/header.css"/>
		<link rel="stylesheet" type="text/css" href="./Public/home/css/content.css"/>
		<script src="./Public/home/js/jquery-1.7.2.min.js"></script>
		<script src="./Public/home/js/style.js"></script>
		<script src="./Public/home/js/area.js"></script>
		<!--上传插件-->
		 <script src="./Public/uploadify/jquery-1.8.2.min.js" type="text/javascript" charset="utf-8"></script>
	    <script src="./Public/uploadify/jquery.uploadify.min.js" type="text/javascript" charset="utf-8"></script>
	    <link rel="stylesheet" type="text/css" href="./Public/uploadify/uploadify.css"/>
	</head>
	<body>
	<div id="edit-password"></div>
	<div class="edit-box">
		<div class="edit-box-title">修改密码<span class="del">x</span></div>
		<div class="edit-box-content">
			<form action="http://localhost/360shop/index.php?m=Home&c=Member&a=edit" method="post">
				<span>旧 密 码：</span><input type="password" name="oldpassword" placeholder="请输入旧密码" /><br />
				<span> 密 码：</span><input type="password" name="password" placeholder="请输入新密码" /><br />
				<span>确认密码：</span><input type="password" name="repassword" placeholder="请确认新密码"/><br />	
				<span>验证码：</span><input type="text" name="code" placeholder="请输入验证码" style="width: 160px;"/><img src="http://localhost/360shop/index.php?m=Home&c=Member&a=code" style="position: relative;top:10px;margin-left: 5px;"/>
				<input type="hidden" name="uid" value="1" />
				<input type="submit" value="提交" class="edit-box-btn"/>
			</form>
		</div>
	</div>
	<!--header-->
	<div id="header">
		<div class="header"> 
			<div class="headerTop">
				<div class="headerLeft">
					<h1>
						<a href="http://localhost/360shop/index.php?m=Home&c=Index&a=index"><img src="./Public/home/images/logo1_cc09ff8.png"/></a>
					</h1>
				</div>
				<div class="headerRight">
					<ul class="header-car">
						<li class="shop-car">
							<a href="http://localhost/360shop/index.php?m=Home&c=Cart&a=index" class="cart-add">购物车(<span>0
               </span>)</a>
						</li>
					</ul>
					<!--搜索-->
					<!--<div class="select">
						<form action="" method="get">
							<input type="text" class="select-box" />
							<input type="submit" value="360手机" class="select-btn"/>
						</form>
					</div>-->
					<ul class="navbar">
						<li><a href="http://localhost/360shop/index.php?m=Home&c=Index&a=index" >首页</a></li>
												<li><a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=1">手机</a></li>
												<li><a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=14">耳机</a></li>
												<li><a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=13">能源</a></li>
												<li><a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=20">智能硬件</a></li>
												<li><a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=18">VR眼镜/车载设备</a></li>
												<li><a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=19">存储</a></li>
											</ul>
				</div>
			</div>
			<div class="header-bottom">
				<div class="header-bottom-box">
					<div class="bottom-left-hover">
						<div class="header-bottom-left">全部商品分类</div>
						<ul class="nav-list">
													<li>
								<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=1" class="nav-list-title">手机</a>
																<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=21">智能机</a>
																<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=22">商务机</a>
																<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=24">双卡双待</a>
															</li>
													<li>
								<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=14" class="nav-list-title">耳机</a>
																<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=25">有线耳机</a>
																<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=26">蓝牙耳机</a>
																<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=27">运动耳机</a>
															</li>
													<li>
								<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=13" class="nav-list-title">能源</a>
																<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=28">电池</a>
																<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=29">移动电源</a>
															</li>
													<li>
								<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=20" class="nav-list-title">智能硬件</a>
																<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=43">智能手表</a>
																<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=30">智能路由器</a>
																<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=31">随身WIFI</a>
															</li>
													<li>
								<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=18" class="nav-list-title">VR眼镜/车载设备</a>
																<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=32">VR眼镜</a>
																<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=33">车载设备</a>
															</li>
													<li>
								<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=19" class="nav-list-title">存储</a>
																<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=34">内存卡</a>
																<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=35">U盘</a>
																<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=36">移动硬盘</a>
															</li>
													<li>
								<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=17" class="nav-list-title">保护</a>
																<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=39">保护套</a>
																<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=40">后壳</a>
																<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=41">贴膜</a>
															</li>
													<li>
								<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=15" class="nav-list-title">手机配件</a>
																<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=37">充电器</a>
																<a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=38">数据线</a>
															</li>
											</ul>
					</div>
					<ul class="header-bottom-right">
						<li class="li-nav">
							<span style="padiving-left: 15px;">网站导航</span>
							<div class="all-list">
																<div><a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=1">手机</a></div>
																<div><a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=14">耳机</a></div>
																<div><a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=13">能源</a></div>
																<div><a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=20">智能硬件</a></div>
																<div><a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=18">VR眼镜/车载设备</a></div>
																<div><a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=19">存储</a></div>
																<div><a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=17">保护</a></div>
																<div><a href="http://localhost/360shop/index.php?m=Home&c=List&a=index&cid=15">手机配件</a></div>
															</div>
						</li>
						                
						<li>
							<a href="http://localhost/360shop/index.php?m=Home&c=Presonal&a=index">CRBHF</a>
							<a href="http://localhost/360shop/index.php?m=Home&c=Member&a=del">退出登录</a>
							
						</li>
												<li class="order"><a href="http://localhost/360shop/index.php?m=Home&c=Presonal&a=order">我的订单</a></li>
					</ul>
				</div>
			</div>
		</div>
	</div>
	<!--/header-->
	<!--container-->
	<div id="container">
		<div class="car-logo">
			<a href="index.html"><img src="./Public/home/images/car-logo.png"/></a>
		</div>
		<div class="car-title">
			<h3>我的购物车</h3>
		</div>
		
		<div class="car-goods">
			<div class="car-goods-title">
				<span class="goods-title-0"></span>
				<span class="goods-title-1">商品</span>
				<span class="goods-title-2">单价</span>
				<span class="goods-title-3">数量</span>
				<span class="goods-title-4">小计</span>
				<span class="goods-title-5">操作</span>
			</div>
			<?php if($goods['goods']){?>
                
			<?php foreach ($goods['goods'] as $k=>$g){?>
			<div class="car-goods-detail goods-box-<?php echo $k?>">
				<div class="goods-detail-0"></div>
				<div class="goods-detail-1">
					<div class="goods-detail-1-img"><img src="<?php echo $g['pic']?>"/></div>
					<div class="goods-detail-1-name">
						<p><?php echo $g['name']?></p>
						<span><?php echo implode(',',$g['options'])?></span>
					</div>
				</div>
				<div class="goods-detail-2"><?php echo $g['price']?>元</div>
				<div class="goods-detail-3">
					<p>
						<a href="javascript:;" class="del<?php echo $k?>">-</a>
						<input type="text" class="goodsNum<?php echo $k?>" value="<?php echo $g['num']?>"  readonly="readonly"/>
						<input type="hidden"  id="SID<?php echo $k?>" value="<?php echo $k?>" />
						<a href="javascript:;" class="add add<?php echo $k?>">+</a>
					</p>
				</div>
				<div class="goods-detail-4 goods-<?php echo $k?>"><p><?php echo $g['total']?>元</p></div>
				<div class="goods-detail-5"><a href="javascript:;" class="<?php echo $k?>">删除</a></div>
			</div>
			<script type="text/javascript">
					$(function(){
						//点击减
						$('.goods-detail-3 .del<?php echo $k?>').click(function(){
							var n=$('.goodsNum<?php echo $k?>').attr('value');
							if(n<=1){
								alert('已到最低购买数量，若要删除商品，请点击删除');
								$('.goodsNum<?php echo $k?>').attr('value',1);
							}else{
								n=n*1-1;
								var SID=$('#SID<?php echo $k?>').attr('value');
								$('.goodsNum<?php echo $k?>').attr('value',n);
								$.ajax({
									type:"post",
									url:"<?php echo U('Cart/newNum')?>",
									data:{update:{SID:SID,num:n}},
									dataType:'json',
									success:function(phpData){
										$('.goods-<?php echo $k?> p').html(phpData.total+"元");
										$('.tips .number').html(phpData.total_rows);
										$('.tips strong').html(phpData.all_total);
									}
								});
							}
							
							
						});
						//点击加
						$('.goods-detail-3 .add<?php echo $k?>').click(function(){
							var n=$('.goodsNum<?php echo $k?>').attr('value');
							if(n>=3){
								alert('已到最大购买数量');
								$('.goodsNum<?php echo $k?>').attr('value',3);
							}else{
								n=n*1+1;
								var SID=$('#SID<?php echo $k?>').attr('value');
								$('.goodsNum<?php echo $k?>').attr('value',n);
								$.ajax({
									type:"post",
									url:"<?php echo U('Cart/newNum')?>",
									data:{update:{SID:SID,num:n}},
									dataType:'json',
									success:function(phpData){
										$('.goods-<?php echo $k?> p').html(phpData.total+"元");
										$('.tips .number').html(phpData.total_rows);
										$('.tips strong').html(phpData.all_total);
									}
								});
							}
						});
						//点击删除
						$('.goods-detail-5 .<?php echo $k?>').click(function(){
							var SID=$('#SID<?php echo $k?>').attr('value');
							$.ajax({
									type:"post",
									url:"<?php echo U('Cart/del')?>",
									data:{del:{SID:SID,num:0}},
									dataType:'json',
									success:function(phpData){
										alert('删除成功');
										$('.goods-box-<?php echo $k?>').css({display:'none'});
										$('.tips .number').html(phpData.total_rows);
										$('.tips strong').html(phpData.all_total);
										$('.cart-add span').html(phpData.total_rows);
									}
							});
							
						});
					});
				</script>
			<?php }?>
			<?php }else{?>
				<div class="car-goods-detail">
					<p class="car-none">购物车中还没有商品，<a href="<?php echo U('Index/index')?>">去添加商品>></a></p>
				</div>
			
               <?php }?>
		</div>
		<script type="text/javascript">
		$(function(){
			
			//点击结算，添加订单
			$('.tips .tips-btn').click(function(){
				<?php if($_SESSION['cart']['goods']):?>
				//获取商品总价
				var gototal=$('.tips strong').html();
				//获取商品的总数量
				var goallnum=$('.tips .number').html();
				//发送订单部分数据进行储存
				$.ajax({
					type:"post",
					url:"<?php echo U('Order/addOrder')?>",
					data:{orderData:{gototal:gototal,goallnum:goallnum}},
					dataType:'json',
					success:function(goid){
						$.ajax({
							type:"post",
							url:"<?php echo U('Order/orderList')?>",
							data:{goid:goid},
							success:function(){
								window.location.href="<?php echo U('Order/index')?>";
							}
						});
					}
				});
				<?php else: ?>
				alert('购物车中没有商品，请去添加商品');
				<?php endif ?>
			});	
		})
		</script>
		<div class="car-action">
			<div class="tips">
				<a href="<?php echo U('Index/index')?>">继续购物</a>
				共<span class="number"><?php echo $goods['total_rows']?></span>件商品
				<p>商品总计：<strong><?php echo $goods['total']?></strong><span>元</span></p>
				<a href="javascript:;" class="tips-btn">去结算</a>
			</div>
		</div>
	</div>
	<!--/container-->
	<!--footer-->
	<div id="footer">
	<div class="footer">
		<p>法律声明|备案证号：京ICP备11014623号-6    © 版权2012-2020 奇酷互联网络科技(深圳)有限公司</p>
	</div>
</div>
	<!--/footer-->
	</body>
</html>
